<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!-- react 核心库 -->
<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<!-- dom相关库 -->
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<!-- Es6->Es5 jsx->js -->
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
 
<div id="app"></div>
<!-- 使用JSX，属性使用text/babel -->
<script type="text/babel">

    class Person extends React.Component{
        render(){
            console.log(this)
            //对象的解析赋值
            const {name, age, sex} = this.props
            return(
                <ul>
                    <li>姓名: {name}</li>
                    <li>年龄: {age}</li>
                    <li>性别: {sex}</li>    
                </ul>
            )
        }
    }
    

    //渲染组件
    // ReactDOM.render(<Person name = "tom" age="18" sex = "女"/>, document.getElementById("app"))


    const p = {
        name: 'jack',
        age: 20,
        sex: "女"
    }
    //只有标签属性可以使用展开运算符展开对象
    ReactDOM.render(<Person {...p}/>, document.getElementById("app"))

    
</script>
 
</body>
</html>